﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using Bymed.SpineScan.WPF.Shared;
using Bymed.SpineScan.WPF.ViewModel;
using System.Diagnostics;

namespace Bymed.SpineScan.WPF
{
    /// <summary>
    /// Interaction logic for HelpPage.xaml
    /// </summary>
    public partial class HelpPage : PageBase
    {
        public HelpPage()
        {
            InitializeComponent();
            InitializePageUnloadStoryboard();
        }

        private void ButtonDeviceManual_Click(object sender, RoutedEventArgs e)
        {
            var fileFullName = Path.Combine(Environment.CurrentDirectory, "DeviceManual.pdf");

            if (File.Exists(fileFullName))
            {
                Process.Start(fileFullName);
            }
            else
            {
                MainViewModel.RequestDisplayMessage("缺少设备手册");
            }
        }

        private void ButtonUserManual_Click(object sender, RoutedEventArgs e)
        {
            var fileFullName = Path.Combine(Environment.CurrentDirectory, "UserManual.pdf");

            if (File.Exists(fileFullName))
            {
                Process.Start(fileFullName);
            }
            else
            {
                MainViewModel.RequestDisplayMessage("缺少用户手册");
            }
        }

        private void ButtonQA_Click(object sender, RoutedEventArgs e)
        {
            var fileFullName = Path.Combine(Environment.CurrentDirectory, "QA.pdf");

            if (File.Exists(fileFullName))
            {
                Process.Start(fileFullName);
            }
            else
            {
                MainViewModel.RequestDisplayMessage("缺少常见问题手册");
            }
        }

        private void ButtonDemoVideo_Click(object sender, RoutedEventArgs e)
        {
            var videoPlayerFileFullName = Path.Combine(Environment.CurrentDirectory, @"DemoVideo\Flashplayer_10.exe");
            var videoFileFullName = Path.Combine(Environment.CurrentDirectory, @"DemoVideo\SpineScanDemoVideo.swf");

            if (File.Exists(videoPlayerFileFullName) && File.Exists(videoFileFullName))
            {
                Process.Start(videoPlayerFileFullName, videoFileFullName);
            }
            else
            {
                MainViewModel.RequestDisplayMessage("缺少演示视频文件或播放器文件");
            }
        }
    }
}
